package com.lz.sports.bean

import android.os.Parcel
import android.os.Parcelable
import com.lz.library.proguard.IProguardField
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

//考点
class ExamSite() : ParcelableString, IProguardField {

    //唯一值 其它关联表的外键
    @Expose
    var id: Int = 0

    @Expose
    var examAreaId: Int = 0

    @Expose
    var examPlanId: Int = 0

    //编号
    @Expose
    var examSiteCode: String = ""

    //项目名称
    @Expose
    var examSiteName: String = ""

    @Expose
    var createTime: Long = 0L

    @Expose
    var updateTime: Long = 0L

    @Expose
    @SerializedName("busExamRoomDTOList")
    var examRoomList: List<ExamRoom>? = null

    override fun str(): String = examSiteCode

    override fun equals(other: Any?): Boolean = other === this || (other is ExamSite && other.id == id)

    constructor(parcel: Parcel) : this() {
        id = parcel.readInt()
        examAreaId = parcel.readInt()
        examPlanId = parcel.readInt()
        examSiteCode = parcel.readString()!!
        examSiteName = parcel.readString()!!
        createTime = parcel.readLong()
        updateTime = parcel.readLong()
        examRoomList = parcel.createTypedArrayList(ExamRoom)
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeInt(id)
        parcel.writeInt(examAreaId)
        parcel.writeInt(examPlanId)
        parcel.writeString(examSiteCode)
        parcel.writeString(examSiteName)
        parcel.writeLong(createTime)
        parcel.writeLong(updateTime)
        parcel.writeTypedList(examRoomList)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ExamSite> {
        override fun createFromParcel(parcel: Parcel): ExamSite {
            return ExamSite(parcel)
        }

        override fun newArray(size: Int): Array<ExamSite?> {
            return arrayOfNulls(size)
        }
    }

}